package com.situ.dao;

import com.situ.bean.Order;
import com.situ.bean.Orderinfo;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface OrderMapper {
    @Select("SELECT * FROM `order` WHERE userid = #{userid}")
    List<Order> getOrdersByUserId(@Param("userid") int userid);

    @Select("SELECT * FROM orderinfo WHERE orderid IN (SELECT id FROM `order` WHERE userid = #{userid})")
    List<Orderinfo> getOrderDetailsByUserId(@Param("userid") int userid);




    @Select("SELECT * FROM `order`")
    List<Order> selectAllOrders();

    // 根据ID查询订单
    @Select("SELECT * FROM `order` WHERE id = #{id}")
    Order selectOrderById(int id);

    // 更新订单


    // 删除订单
    @Delete("DELETE FROM `order` WHERE id = #{id}")
    void deleteOrder(int id);








}